//
//  CallBackNumberHintCell.swift
//  d11
//
//  Created by peale_pro on 2019/10/16.
//  Copyright © 2019 Tech_001. All rights reserved.
//

import UIKit
typealias NumberAddBlock = () -> Void
class CallBackNumberHintCell: UITableViewCell {
    var titleLabel : UILabel?
    var addBtn : UIButton?
    var numberAddBlock: NumberAddBlock?
    func callChangeBlock(_ block: @escaping NumberAddBlock) {
        numberAddBlock = block
    }
    override init(style: UITableViewCell.CellStyle, reuseIdentifier: String?) {
        super.init(style: style, reuseIdentifier: reuseIdentifier)
        self.selectionStyle = UITableViewCell.SelectionStyle.none
        self.setUpUI()

    }
    
    required init?(coder aDecoder: NSCoder) {
        super.init(coder: aDecoder)
    }
    
    func setUpUI() -> Void {
        self.titleLabel = UILabel.init()
           self.titleLabel?.font = UIFont.systemFont(ofSize: 14)
           self.titleLabel?.text = "如果注册电话号码无法接听,请点击输入能接听的新号码"
           self.titleLabel?.textAlignment = .left
           self.titleLabel?.textColor = HexRGBAlpha(0x444444, 1)
           self.contentView.addSubview(self.titleLabel!)
           self.titleLabel?.snp.makeConstraints{(make) in
               make.left.equalToSuperview().offset(12)
               make.right.equalToSuperview().offset(-12)
               make.height.equalTo(30)
               make.top.equalToSuperview()
           }
           self.addBtn = UIButton.init(type: .custom)
           self.addBtn?.setTitle("✚ 联系其他电话号码", for: .normal)
        //   self.addBtn?.titleLabel?.textAlignment = .left
           self.addBtn?.contentHorizontalAlignment = .left
           self.addBtn?.titleLabel?.font = UIFont.systemFont(ofSize: 14)
           self.addBtn?.setTitleColor(HexRGBAlpha(0xFBBC64, 1), for: .normal)
         self.addBtn?.addTarget(self, action:  #selector(self.actionToAddNumber), for: .touchUpInside)
           self.contentView.addSubview(self.addBtn!)
           self.addBtn?.snp.makeConstraints{(make) in
               make.left.equalToSuperview().offset(15)
               make.right.equalToSuperview().offset(-12)
               make.height.equalTo(30)
               make.top.equalTo((titleLabel?.snp.bottom)!)
           }
    }
    @objc func actionToAddNumber() -> Void {
        if self.numberAddBlock != nil{
            self.numberAddBlock!()
        }
    }

}
